package com.ztt.service.impl;

import com.ztt.pojo.entity.zttUser;
import com.ztt.mapper.UserMapper;
import com.ztt.service.UserService;
import com.ztt.utils.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public zttUser getUserByUsername(String username) {
        return userMapper.findByUserName(username);
    }

    @Override
    public void insertUser(zttUser user) {
        //加密
        String md5String = MD5.md5util(user.getPassword());
        user.setPassword(md5String);

        //添加
        userMapper.insertUser(user);
    }
}
